//
//  TopView.m
//  iBook
//
//  Created by wangjing on 14/12/18.
//  Copyright (c) 2014年 wikiflyer. All rights reserved.
//

#import "TopView.h"

@implementation TopView

-(void)initView{
    
}
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    
    CGFloat labelW = frame.size.width;
    CGFloat labelH = 40;
    CGFloat labelX = 0;
    CGFloat labelY = 0;
    UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(labelX, labelY, labelW, labelH)];
    title.text = @"全部图书";
    [self addSubview:title];
    
    CGFloat segW = frame.size.width;
    CGFloat segH = 30;
    CGFloat segX = 0;
    CGFloat segY = labelH;
//    UISegmentedControl *segControl = [[UISegmentedControl alloc]initWithFrame:CGRectMake(segX, segY, segW, segH)];
    
    NSArray *segmentedArray = [NSArray arrayWithObjects:@"左边",@"右边",nil];
    UISegmentedControl *segControl = [[UISegmentedControl alloc]initWithItems:segmentedArray];
    segControl.frame = CGRectMake(segX, segY, segW, segH);
    [self addSubview:segControl];
    return  self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
